﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace mtdsharp
{
    class StopTime
    {
        private string trip_id;
        public string TripID
        {
            get { return trip_id; }
        }

        private DateTime departure_time;
        public DateTime DepartureTime
        {
            get { return departure_time; }
        }

        private string stop_id;
        public string StopID
        {
            get { return stop_id; }
        }

        private int stop_sequence;
        public int StopSequence
        {
            get { return stop_sequence; }
        }

        private List<Stop> stops;
        public List<Stop> Stops
        {
            get { return stops; }
        }

        public StopTime(string gtfsLine)
        {
            // Split up the comma-separated values from the GTFS data line
            string[] gtfsElements = gtfsLine.Split(',');

            // Set the internal fields
            this.trip_id = gtfsElements[0];
            this.stop_id = gtfsElements[3];
            this.stop_sequence = Convert.ToInt32(gtfsElements[4]);

            this.departure_time = DateTime.Today;
            string[] hms = gtfsElements[2].Split(':');

            this.departure_time.AddHours(Convert.ToInt32(hms[0]));
            this.departure_time.AddMinutes(Convert.ToInt32(hms[1]));
            this.departure_time.AddSeconds(Convert.ToInt32(hms[2]));
        }
    }
}
